@charset 'UTF-8';

:root {
    --color-primary: #0366d6;
    --color-accent: #d6036c;
    --color-background: #f6f8fa;
    --color-surface: #ffffff;
    --color-border: #e1e4e8;
    --color-text: #212529;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    overflow: hidden;
    font-family: system-ui, -apple-system, sans-serif;
    color: var(--color-text);
    background-color: var(--color-background);
    line-height: 1.5;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 20px;
    border-bottom: 1px solid var(--color-border);
    user-select: none;
}

header h1 {
    font-size: 18px;
    /* color: var(--color-primary); */
}

main {
    flex: 1;
    display: flex;
    background: #ffffff;
    overflow: hidden;
}

ul {
    list-style: none;
}

.nav {
    display: flex;
    font-size: 14px;
}

.nav-item {
    position: relative;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.nav-item:hover {
    background-color: #e9ecef;
}

.nav-item:hover .dropdown-menu {
    display: block;
    background: #e9ecef;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 150px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    animation: slideDown 0.3s ease;
    z-index: 100;
}

.dropdown-menu.active {
    display: block;
}

button {
    background-color: transparent;
    border: none;
    cursor: pointer;
}

.menu-item {
    position: relative;
    padding: 0.3rem 1rem 0.3rem 1.3rem;
    color: #212529;
    transition: all 0.2s;
    border-radius: 4px;
    border-bottom: 1px solid #f1f3f5;
}

/* 添加左侧竖线 */
.menu-item::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 16px;
    background: #0366d6;
    border-radius: 1px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.menu-item:hover::before {
    background: #d6036c;

}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: #fff;
}

.CodeMirror {
    flex: 1;
    min-width: 600px;
    height: 100%;
    font-size: 14px;
    border-right: 2px solid var(--color-border);
}

#preview {
    flex: 1;
    background: #fafbfc;
    padding: 5px;
    border: none;
}

/* 当窗口宽度小于800px时隐藏iframe */
@media (max-width: 800px) {
    #preview {
        display: none;
    }

    header {
        display: none;
    }
}